package morenoapp.components.common.table.column;

import javax.swing.table.TableCellRenderer;

/**
 *
 * @author dmitry.mamonov
 */
public abstract class AbstractColumnMeta implements ColumnMeta {

    String name;
    Class type;
    int prefferedWidth;
    TableCellRenderer tableCellRenderer;

    public AbstractColumnMeta(String _name, Class _type, int _prefferedWidth, TableCellRenderer _tableCellRenderer) {
        this.name = _name;
        this.type = _type;
        this.prefferedWidth = _prefferedWidth;
        this.tableCellRenderer = _tableCellRenderer;
    }
    
    public AbstractColumnMeta(String _name, Class _type, int _prefferedWidth) {
        this(_name, _type, _prefferedWidth, (TableCellRenderer)null);
    }

    public String getName() {
        return name;
    }

    public int getPrefferedWidth() {
        return prefferedWidth;
    }

    public int getMaximumWidth() {
        return Short.MAX_VALUE;
    }

    public int getMinimumWidth() {
        return 0;
    }

    public boolean isResizable() {
        return true;
    }

    public Class getType() {
        return type;
    }

    public boolean isEditable() {
        return false;
    }

    public void setRowValue(int row, Object value) {
        throw new UnsupportedOperationException("Default column model is not editable."); //NOI18N
    }

    public TableCellRenderer getTableCellRenderer() {
        return this.tableCellRenderer;
    }

    public void setTableCellRenderer(TableCellRenderer tableCellRenderer) {
        this.tableCellRenderer = tableCellRenderer;
    }

    public String getTooltip() {
        return null;
    }
}